package zsl.generator;
import java.io.IOException;

import zsl.utils.WordCount;
import zsl.utils.WordCountList;


public class UniformWordListGenerator extends WordListGenerator {

	public UniformWordListGenerator(int dictLen, long seed) throws IOException {
		super(dictLen, seed);
	}

	@Override
	public WordCountList generateWords(int numOfWord) {
		WordCountList wordList = new WordCountList(numOfWord);
		int curLine = 0;
		int curDictLen = dictLen;
		String[] copyedDict = dict.clone();
		for (int i = 0; i < numOfWord; i++) {
			curLine = randomLineGen.nextInt(curDictLen);
			wordList.add(new WordCount(copyedDict[curLine], (numOfWord-i)*3));
			copyedDict[curLine] = copyedDict[curDictLen-1];
			curDictLen--;
		}
		
		return wordList;
	}
	
	public static void main(String[] args) throws IOException {
		WordListGenerator wg = new UniformWordListGenerator(100,100L);
		System.out.println(wg.generateWords(100));
		System.out.println(wg.generateWords(100));
		System.out.println(wg.generateWords(100));
		System.out.println(wg.generateWords(100));
		System.out.println(wg.generateWords(100));
		System.out.println(wg.generateWords(100));
		System.out.println(wg.generateWords(100));
		System.out.println(wg.generateWords(100));
		System.out.println(wg.generateWords(100));
		System.out.println(wg.generateWords(100));
		System.out.println(wg.generateWords(100));
		System.out.println(wg.generateWords(100));
		System.out.println(wg.generateWords(100));
		System.out.println(wg.generateWords(100));
	}
}
